package com.qinggeng.project.api.dto;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.qinggeng.project.system.domain.GoodsGift;
import io.swagger.annotations.ApiModel;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@Data
@ApiModel("商品详情列表")
public class GoodsInfoDto {

    //商品ID
    private Long goodsId;

    //商品库存ID
    private Long keepId;

    //商品名称
    private String goodsName;

    //商品图片
    private String goodsImg;

    //商品图片
    private String goodsLongImg;

    //列表图片
    private String listImg;

    //商品详情
    private String goodsContent;

    //商品价格
    private BigDecimal goodsPrice;

    //划线价格
    private BigDecimal linePrice;

    //拼团价格
    private BigDecimal groupPrice;

    //商品属性
    private String attributes;

    //属性名
    private String attributesName;

    //商品主类
    private Long mainCategory;

    //库存
    private Integer keepNum;

    //销量
    private Integer saleNum;

    //商户ID
    private Long shopId;

    //商户地址
    private String shopAddress;

    //商户位置信息
    private Float shopLng;
    private Float shopLat;

    //预计送达时间
    private String sendTime;

    //店铺图片
    private String storeImgs;

    //店铺资质
    private String storePapers;

    private String goodsType;

    //礼品信息
    private List<GoodsGift> giftList;

    //商品状态（10=下架  20=上架）
    private String status;

    //商品短视频
    private String goodsVideo;

    //同城优惠百分比
    private String proportion;

    //商品提成百分比
    private String percent;

    //商品进价
    private BigDecimal buyPrice;

    //起售数量
    private String lowNum;
    //规格
    private String spec;
    //人气
    private String popularity;
    //多少人想要
    private String wantValue;

    //预售时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date startDate;

    private String startDateStamp;

    //提货时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date pickDate;

    private String pickDateStamp;

    //限购数量
    private Integer limitNum;

    //平台保障
    private String guarantee="闪电退款";

    //会员价
    private BigDecimal vipPrice;


  public String [] getListImgArray(){
        if (this.listImg != null){
            return this.listImg.split(",");
        }
        return null;
    }

    public String [] getStoreImgsArray(){
        if (this.storeImgs != null){
            return this.storeImgs.split(",");
        }
        return null;
    }

    public String [] getStorePapersArray(){
        if (this.storePapers != null){
            return this.storePapers.split(",");
        }
        return null;
    }
}
